﻿using System;
using System.ServiceModel;
using System.Security.Permissions;
using System.Web.Security;

namespace AllMyMoney.WCFService
{
    public sealed class UserManagement : IUserManagement
    {
        public UserManagement()
        {
        }

        [PrincipalPermission(SecurityAction.Demand,Role="Administrator"),
         I18n()]
        public bool createUser(string username, string email, string passwordQuestion, string passwordAnswer)
        {
            International internationalHeader = International.GetHeaderFromIncomeMessage();
            if (internationalHeader == null)
                Console.WriteLine("Failed to get international header");
            else
                Console.WriteLine("International header culture is {0}", internationalHeader.Locale);
            /*
            MembershipCreateStatus status;
            Membership.CreateUser(username, null, email, passwordQuestion, passwordAnswer, true, out status);

            switch (status)
            {
                case MembershipCreateStatus.DuplicateEmail:
                    break;
                case MembershipCreateStatus.DuplicateProviderUserKey:
                case MembershipCreateStatus.DuplicateUserName:
                    break;
                case MembershipCreateStatus.InvalidAnswer:
                    break;
                case MembershipCreateStatus.InvalidEmail:
                    break;
                case MembershipCreateStatus.InvalidPassword:
                    break;
                case MembershipCreateStatus.InvalidProviderUserKey:
                case MembershipCreateStatus.InvalidUserName:
                    break;
                case MembershipCreateStatus.InvalidQuestion:
                    break;
                case MembershipCreateStatus.UserRejected:
                    break;
                case MembershipCreateStatus.Success:
                    break;
            }
            */
            return true;
        }
    }
}